﻿using System;
using System.Data;
using System.Collections.Generic;
using Petra.Gis.Support;
using Petra.Gis.DataServices;


namespace Petra.Gis
{

  public class DataConnectionPool : DictionaryPlus<string, SpatialDbConnection>
  {


    public DataConnectionPool()
      : base() { }



    public override void Add(string key, SpatialDbConnection conn)
    {
      // add to collection
      base.Add(key, conn);

      // if connection is closed then reopen here
      if (conn.State != ConnectionState.Open &&
          conn.XState == ConnectionState.Open)
        conn.Open();

    }



  }
}
